package org.lgiavedoni.android.franq.core.bean;

import lombok.Data;

import org.lgiavedoni.android.franq.core.contact.Contact;
import org.lgiavedoni.android.franq.service.phone.ContactService;

@Data
public class SMS {
	private final String from;
	private final String text;
	private Contact contact;
	
	//TODO: remove this using lombok
	public SMS(String from, String text) {
		super();
		this.from = from;
		this.text = text;
	}	

	public String getFromText() {
		if (contact == null) {
			contact = ContactService.inst.getContactByNumber(getFrom());
		}
		return contact != null ? contact.getName() : getFrom();
	}

}
